<?php

/**
 * 友情链接
 *
 * @package         YDCMS
 * @author          QQ:644157559 <644157559@qq.com>
 * @version         $Id: FlinkService.class.php v1.0 2014-06-23 17:27:03 $
 */
namespace Admin\Service;
class FlinkService extends CommonService{
    
    /**
     * 数据入库
     * @param Array $data
     * @return Array
     */
    public function add($data) {
        $FlinkModel = $this->getD();
        if(false === ($flink = $FlinkModel->create($data))){
            return $this->errorResultReturn($FlinkModel->getError());
        }
        if(false === $FlinkModel->add($flink)){
            return $this->errorResultReturn("系统繁忙！");
        }
        return $this->resultReturn(TRUE);
    }
    
    /**
     * 更新数据
     * @param Array $data
     * @return Array
     */
    public function update($data) {
        $FlinkModel = $this->getD();
        if(false === ($flink = $FlinkModel->create($data))){
            return $this->errorResultReturn($FlinkModel->getError());
        }
        if(false === $FlinkModel->save($flink)){
            return $this->errorResultReturn("系统繁忙！");
        }
        return $this->resultReturn(TRUE);
    }
    /**
     * 根据ID获取详细
     * @param Int $id
     * @return Array
     */
    public function getById($id) {
        return $this->getM()->getById($id);
    }
    /**
     * 删除
     * @param int $id
     * @return bool
     */
    public function delete($id) {
        return $this->getM()->delete($id);
    }
    
    /**
     * 
     * @return string
     */
    protected function getModelName() {
        return "Flink";
    }
}
